package com.iflytek.mapper;

import com.iflytek.bean.Role;
import com.iflytek.bean.RoleExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface RoleMapper {
	
	//查询管理员所拥有的角色
		@Select("select * from t_admin_role ar "
				+ "join t_role r on r.id = ar.role_id "
				+ "where ar.admin_id=#{id}")
		List<Role> getAdminRoles(Integer id);
		
		
		//查询管理员所拥有的权限
		@Select("select m.permission from t_admin_role ar "
				+ "join t_role_menu rm on ar.role_id = rm.role_id "
				+ "join t_menu m on rm.menu_id = m.id "
				+ "where ar.admin_id=#{id}")
		List<String> getAdminPermissions(Integer id);
		
    long countByExample(RoleExample example);

    int deleteByExample(RoleExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(Role record);

    int insertSelective(Role record);

    List<Role> selectByExample(RoleExample example);

    Role selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") Role record, @Param("example") RoleExample example);

    int updateByExample(@Param("record") Role record, @Param("example") RoleExample example);

    int updateByPrimaryKeySelective(Role record);

    int updateByPrimaryKey(Role record);
}